#include "code.h"
#include "stdafx.h"



int Buffer(PDU* buffer1, char  buffer2[])
{
	memset(buffer2, 0, sizeof(buffer2));
	memcpy(buffer2, buffer1, sizeof(PDU));
	return 0;
}
int GetDataFromPDU(PDU* buf, char *databuf)
{
	memset(databuf, 0, sizeof(databuf));
	memcpy(databuf, buf->data, buf->length);

	return buf->length;
}


int SetDataPacket(PDU * buf,char type,int flag, char * data, int datalen)
{
	memset(buf, 0, sizeof(buf));
	buf->type = type;
	buf->flag = flag;
	buf->length = datalen;
	memcpy(buf->data, data, datalen);

	return 0;
}